<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>MiXiM: BaseModule Class Reference</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>


</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">MiXiM
   &#160;<span id="projectnumber">2.3</span>
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.5.1 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li><a href="dirs.html"><span>Directories</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
      <li><a href="classes.html"><span>Class&#160;Index</span></a></li>
      <li><a href="inherits.html"><span>Class&#160;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
    </ul>
  </div>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
  initNavTree('a00027.html','');
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pro-methods">Protected Member Functions</a> &#124;
<a href="#pro-attribs">Protected Attributes</a> &#124;
<a href="#pro-static-attribs">Static Protected Attributes</a> &#124;
<a href="#pri-methods">Private Member Functions</a>  </div>
  <div class="headertitle">
<div class="title">BaseModule Class Reference<div class="ingroups"><a class="el" href="a00516.html">baseModules - base module classes of MiXiM</a></div></div>  </div>
</div>
<div class="contents">
<!-- doxytag: class="BaseModule" -->
<p>Base class for all simple modules of a host.  
 <a href="a00027.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="a00272_source.html">BaseModule.h</a>&gt;</code></p>
<div class="dynheader">
Inheritance diagram for BaseModule:</div>
<div class="dyncontent">
<div class="center"><img src="a00593.png" border="0" usemap="#BaseModule_inherit__map" alt="Inheritance graph"/></div>
<center><span class="legend">[<a target="top" href="graph_legend.html">legend</a>]</span></center></div>
<div class="dynheader">
Collaboration diagram for BaseModule:</div>
<div class="dyncontent">
<div class="center"><img src="a00594.png" border="0" usemap="#BaseModule_coll__map" alt="Collaboration graph"/></div>
<center><span class="legend">[<a target="top" href="graph_legend.html">legend</a>]</span></center></div>

<p><a href="a00595.html">List of all members.</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ab8e21b1eab02b58e24ab06858faa5104"></a><!-- doxytag: member="BaseModule::BaseModule" ref="ab8e21b1eab02b58e24ab06858faa5104" args="(unsigned stacksize)" -->
&#160;</td><td class="memItemRight" valign="bottom"><b>BaseModule</b> (unsigned stacksize)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00027.html#a03030e439aaf030c83da6e71e8be2f80">initialize</a> (int)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Basic initialization for all modules.  <a href="#a03030e439aaf030c83da6e71e8be2f80"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00027.html#ace4692f0eb43b2d4ca4e46f81b5c77a1">numInitStages</a> () const </td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Divide initialization into two stages.  <a href="#ace4692f0eb43b2d4ca4e46f81b5c77a1"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">std::string&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00027.html#a662d45fd2e3edf53d40e84b98f4dc885">logName</a> (void) const </td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Function to get the logging name of the host.  <a href="#a662d45fd2e3edf53d40e84b98f4dc885"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="af7e5a2e34b218afcc9b92d75e5e11df8"></a><!-- doxytag: member="BaseModule::getNode" ref="af7e5a2e34b218afcc9b92d75e5e11df8" args="() const " -->
const cModule *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00027.html#af7e5a2e34b218afcc9b92d75e5e11df8">getNode</a> () const </td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Get a reference to the local node module. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a9195e1fe5a0ca770e7d29351e0ab2ecf"></a><!-- doxytag: member="BaseModule::receiveSignal" ref="a9195e1fe5a0ca770e7d29351e0ab2ecf" args="(cComponent *source, simsignal_t signalID, cObject *obj)" -->
virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00027.html#a9195e1fe5a0ca770e7d29351e0ab2ecf">receiveSignal</a> (cComponent *source, simsignal_t signalID, cObject *obj)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Called by the signaling mechanism whenever a change of a category occurs to which we have subscribed. In this base class just handle the host state switching and some debug notifications. <br/></td></tr>
<tr><td colspan="2"><h2><a name="pro-methods"></a>
Protected Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00027.html#a44220aa650488eee8ad121f8bc599265">handleHostState</a> (const <a class="el" href="a00098.html">HostState</a> &amp;state)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Called whenever the hosts state changes.  <a href="#a44220aa650488eee8ad121f8bc599265"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00027.html#a2edf4477674604a8c2eb2b95e952694a">switchHostState</a> (<a class="el" href="a00098.html#a5002302e0f07bbd982c6e5d65eaa9c3c">HostState::States</a> state)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Switches the host to the passed state.  <a href="#a2edf4477674604a8c2eb2b95e952694a"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aabf0226159b22b46e70031fd3bb3b1b2"></a><!-- doxytag: member="BaseModule::findHost" ref="aabf0226159b22b46e70031fd3bb3b1b2" args="(void)" -->
cModule *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00027.html#aabf0226159b22b46e70031fd3bb3b1b2">findHost</a> (void)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Function to get a pointer to the host module. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a2ab00477b78a8e8954472688f466d4ea"></a><!-- doxytag: member="BaseModule::findHost" ref="a2ab00477b78a8e8954472688f466d4ea" args="(void) const " -->
const cModule *&#160;</td><td class="memItemRight" valign="bottom"><b>findHost</b> (void) const </td></tr>
<tr><td colspan="2"><h2><a name="pro-attribs"></a>
Protected Attributes</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="af32711ea117b066fcd10081a17bb81d4"></a><!-- doxytag: member="BaseModule::debug" ref="af32711ea117b066fcd10081a17bb81d4" args="" -->
bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00027.html#af32711ea117b066fcd10081a17bb81d4">debug</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Debug switch for all other modules. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ad2e5c785ee5b988e624a11a9b80e2bce"></a><!-- doxytag: member="BaseModule::notAffectedByHostState" ref="ad2e5c785ee5b988e624a11a9b80e2bce" args="" -->
bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00027.html#ad2e5c785ee5b988e624a11a9b80e2bce">notAffectedByHostState</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Stores if this module is affected by changes in the hosts state. If not explicitly set this module has to capture changes in the host state. <br/></td></tr>
<tr><td colspan="2"><h2><a name="pro-static-attribs"></a>
Static Protected Attributes</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a0d89757df3cc2bf55649eee85aad6402"></a><!-- doxytag: member="BaseModule::catHostStateSignal" ref="a0d89757df3cc2bf55649eee85aad6402" args="" -->
static const <a class="el" href="a00201.html">simsignalwrap_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00027.html#a0d89757df3cc2bf55649eee85aad6402">catHostStateSignal</a> = <a class="el" href="a00201.html">simsignalwrap_t</a>(MIXIM_SIGNAL_HOSTSTATE_NAME)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Stores the category of the <a class="el" href="a00098.html" title="HostState is published by the battery to announce host failure.">HostState</a>. <br/></td></tr>
<tr><td colspan="2"><h2><a name="pri-methods"></a>
Private Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00027.html#ad0cbb062952b5a1bc9eaa725de983505">BaseModule</a> (const <a class="el" href="a00027.html">BaseModule</a> &amp;)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Function to get the logging name of id.  <a href="#ad0cbb062952b5a1bc9eaa725de983505"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ac5c54f656cb8c9b794060b2d88d5a161"></a><!-- doxytag: member="BaseModule::operator=" ref="ac5c54f656cb8c9b794060b2d88d5a161" args="(const BaseModule &amp;)" -->
<a class="el" href="a00027.html">BaseModule</a> &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00027.html#ac5c54f656cb8c9b794060b2d88d5a161">operator=</a> (const <a class="el" href="a00027.html">BaseModule</a> &amp;)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Assignment operator is not allowed. <br/></td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>Base class for all simple modules of a host. </p>
<p>This method raises an error if the host state changes to something else than ACTIVE. Therefore that a sub-classing module can be used in a simulation where the host state can change it has to override that method which forces the author to make sure the module reacts well to host state changes. Alternatively one can also set a "notAffectedByHostState" parameter of the module to true.</p>
<p>The base module additionally provides a function findHost which returns a pointer to the host module and a function hostIndex to return the index of the host module. The latter one correspondes to the index shown in tkenv and comes in very handy for testing and debugging using tkenv. It is used e.g. in all the 'print' macros used for debugging.</p>
<p>There will never be a stand-alone <a class="el" href="a00027.html" title="Base class for all simple modules of a host.">BaseModule</a> module.</p>
<p>Note: most modules wont derive from <a class="el" href="a00027.html" title="Base class for all simple modules of a host.">BaseModule</a> directly but from its sub class "MiximBatteryAccess" which extends <a class="el" href="a00027.html" title="Base class for all simple modules of a host.">BaseModule</a> by several methods for accessing the battery module.</p>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="a00140.html" title="Extends BaseModule by several methods which provide access to the battery module.">MiximBatteryAccess</a></dd></dl>
<dl class="author"><dt><b>Author:</b></dt><dd>Steffen Sroka </dd>
<dd>
Andreas Koepke </dd></dl>
</div><hr/><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="ad0cbb062952b5a1bc9eaa725de983505"></a><!-- doxytag: member="BaseModule::BaseModule" ref="ad0cbb062952b5a1bc9eaa725de983505" args="(const BaseModule &amp;)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">BaseModule::BaseModule </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="a00027.html">BaseModule</a> &amp;&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td><code> [private]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Function to get the logging name of id. </p>
<p>Copy constructor is not allowed. </p>

</div>
</div>
<hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="a44220aa650488eee8ad121f8bc599265"></a><!-- doxytag: member="BaseModule::handleHostState" ref="a44220aa650488eee8ad121f8bc599265" args="(const HostState &amp;state)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void BaseModule::handleHostState </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="a00098.html">HostState</a> &amp;&#160;</td>
          <td class="paramname"><em>state</em></td><td>)</td>
          <td><code> [protected, virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Called whenever the hosts state changes. </p>
<p>Default implementation of this method throws an error whenever the host state changes and the "notAffectedbyHostState" variable is not explicitly set. This is because every module of a host has to make sure to react well to changes in the host state. Or it has to explicitly set its parameter "notAffectedbyHostState" to true. </p>

<p>Reimplemented in <a class="el" href="a00174.html#ab687d180a389989e036e158765fe6f29">PhyLayerBattery</a>, <a class="el" href="a00041.html#a844beeae7f5dd04a628538b1b9fead02">BurstApplLayerBattery</a>, and <a class="el" href="a00193.html#aad95dbfe21ea8354b02af1e9b4d387f7">SimpleBattery</a>.</p>

<p>References <a class="el" href="a00098.html#a3167de707748fd5280fce231d6cbcf90">HostState::get()</a>, and <a class="el" href="a00027.html#ad2e5c785ee5b988e624a11a9b80e2bce">notAffectedByHostState</a>.</p>

<p>Referenced by <a class="el" href="a00027.html#a9195e1fe5a0ca770e7d29351e0ab2ecf">receiveSignal()</a>.</p>
<div class="fragment"><pre class="fragment">{
  <span class="keywordflow">if</span>(<a class="code" href="a00027.html#ad2e5c785ee5b988e624a11a9b80e2bce" title="Stores if this module is affected by changes in the hosts state. If not explicitly set this module ha...">notAffectedByHostState</a>)
    <span class="keywordflow">return</span>;

  <span class="keywordflow">if</span>(state.<a class="code" href="a00098.html#a3167de707748fd5280fce231d6cbcf90" title="Returns the host state.">get</a>() != HostState::ACTIVE) {
    error(<span class="stringliteral">&quot;Hosts state changed to something else than active which&quot;</span>
        <span class="stringliteral">&quot; is not handled by this module. Either handle this state&quot;</span>
        <span class="stringliteral">&quot; correctly or if this module really isn&#39;t affected by the&quot;</span>
        <span class="stringliteral">&quot; hosts state set the parameter \&quot;notAffectedByHostState\&quot;&quot;</span>
        <span class="stringliteral">&quot; of this module to true.&quot;</span>);
  }
}
</pre></div>
</div>
</div>
<a class="anchor" id="a03030e439aaf030c83da6e71e8be2f80"></a><!-- doxytag: member="BaseModule::initialize" ref="a03030e439aaf030c83da6e71e8be2f80" args="(int)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void BaseModule::initialize </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>stage</em></td><td>)</td>
          <td><code> [virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Basic initialization for all modules. </p>
<p>Subscription should be in stage==0, and firing notifications in stage==1 or later.</p>
<p>NOTE: You have to call this in the <a class="el" href="a00027.html#a03030e439aaf030c83da6e71e8be2f80" title="Basic initialization for all modules.">initialize()</a> function of the inherited class! </p>

<p>Reimplemented in <a class="el" href="a00197.html#a20a43187e836ef7fb9c26a6132b3b77a">SimpleNetwLayer</a>, <a class="el" href="a00175.html#a0bb0cfac6ebb5459b7480bf9df337a3f">PhyLayerUWBIR</a>, <a class="el" href="a00029.html#a08704deaf03b73c8eda67cc60e670853">BasePhyLayer</a>, <a class="el" href="a00069.html#a660262c629f33b00401249d3fdac49be">CSMAMacLayer</a>, <a class="el" href="a00174.html#a815f95ad9fe89412ff3c5991ec1cfafe">PhyLayerBattery</a>, <a class="el" href="a00053.html#aad16a20e89c1415737abbebd2d2e4383">ConnectionManagerAccess</a>, <a class="el" href="a00026.html#a61c82dc3b225eac37f7fa9936c28c2c3">BaseMacLayer</a>, <a class="el" href="a00094.html#ab47e1d524db55d57edc7f86db5d92735">Flood</a>, <a class="el" href="a00067.html#a24e7a48bd1d9036139c75b558ade4161">csma</a>, <a class="el" href="a00126.html#a2100ca7de5c5eedb3e7f0e11ca9fca14">LMacLayer</a>, <a class="el" href="a00025.html#a70f5ea30a9980d57b8384faed29ec3eb">BaseLayer</a>, <a class="el" href="a00128.html#ab81dae24d79c2ef010301e2c219966c1">Mac80211</a>, <a class="el" href="a00028.html#a1e521b5549bfe29ae94d95265c0fe8d2">BaseNetwLayer</a>, <a class="el" href="a00227.html#ade7fd8114864ff11327435c57cab0e53">WiseRoute</a>, <a class="el" href="a00035.html#aacfdc6bca51f7097b58556fdf1744689">BMacLayer</a>, <a class="el" href="a00196.html#a9a23cdc88daa658398f0bc10ac4ed219">SimpleMacLayer</a>, <a class="el" href="a00217.html#a083fea2270d41c26495fbc8e2bbe95be">TrafficGen</a>, <a class="el" href="a00156.html#a4ad89047bebb99eaad2fd239cbc9e601">NetworkStackTrafficGen</a>, <a class="el" href="a00016.html#aa3ebaf5d1d1bdbec4648b07f65eb4145">BaseApplLayer</a>, <a class="el" href="a00017.html#a424a847f259dbde5a83aa7c30a3a32bd">BaseArp</a>, <a class="el" href="a00190.html#a51d4997ab7973ee4b174ae49fb9b658f">SamplePhyLayer</a>, <a class="el" href="a00223.html#a0fcaae9c3cefb73372b7290ff4d9092d">UWBIRMac</a>, <a class="el" href="a00191.html#aac9612746afd57f4393658789d3c64fe">SensorApplLayer</a>, <a class="el" href="a00033.html#a07bebc9788ff9ec28a8b4d3d1473d977">BatteryStats</a>, <a class="el" href="a00180.html#abf8d4a866267695fc27802ada7862526">ProbabilisticBroadcast</a>, <a class="el" href="a00008.html#abab6939a0c82122391528d386df97c2c">AlohaMacLayer</a>, <a class="el" href="a00014.html#a3ca8e0906ce88bc0a15f066e15cc0377">ArpHost</a>, <a class="el" href="a00040.html#ae693c2f1fc343d8c253778a1de1c4082">BurstApplLayer</a>, <a class="el" href="a00041.html#a8ccaf74e9a310c5f45447283df6dee7e">BurstApplLayerBattery</a>, <a class="el" href="a00193.html#a02f43017e7f375fb12a3299f929f99d3">SimpleBattery</a>, <a class="el" href="a00005.html#acf3b1cfc2915c422e5a10e7993884b9b">Aggregation</a>, <a class="el" href="a00207.html#adc3a512816290a38b548f973bba993e7">TestApplication</a>, <a class="el" href="a00208.html#a8df32483962ebc40e1eed225716e54cb">TestApplLayer</a>, <a class="el" href="a00089.html#abdee96cebdcaeef041d21f4dd8d90b9d">DummyRoute</a>, <a class="el" href="a00068.html#abbb7175c6f28345ca29c3ca6f98732fc">CSMA802154</a>, <a class="el" href="a00003.html#ad3541d0be9b308c1b72633d25300afdb">AdaptiveProbabilisticBroadcast</a>, <a class="el" href="a00129.html#aa7351afc794f983e34dbc86d63cb3dea">Mac80211MultiChannel</a>, and <a class="el" href="a00176.html#a77bbef34f56830b35aafbdbb6ec56627">phyPER</a>.</p>

<p>References <a class="el" href="a00027.html#a0d89757df3cc2bf55649eee85aad6402">catHostStateSignal</a>, <a class="el" href="a00027.html#af32711ea117b066fcd10081a17bb81d4">debug</a>, <a class="el" href="a00027.html#aabf0226159b22b46e70031fd3bb3b1b2">findHost()</a>, <a class="el" href="a00201.html#aa01f017b96087bc252445206777e0080">simsignalwrap_t::initialize()</a>, and <a class="el" href="a00027.html#ad2e5c785ee5b988e624a11a9b80e2bce">notAffectedByHostState</a>.</p>
<div class="fragment"><pre class="fragment">                                     {
    <span class="keywordflow">if</span> (stage == 0) {
      <a class="code" href="a00027.html#ad2e5c785ee5b988e624a11a9b80e2bce" title="Stores if this module is affected by changes in the hosts state. If not explicitly set this module ha...">notAffectedByHostState</a> =  hasPar(<span class="stringliteral">&quot;notAffectedByHostState&quot;</span>)
                 &amp;&amp; par(<span class="stringliteral">&quot;notAffectedByHostState&quot;</span>).boolValue();
        hasPar(<span class="stringliteral">&quot;debug&quot;</span>) ? <a class="code" href="a00027.html#af32711ea117b066fcd10081a17bb81d4" title="Debug switch for all other modules.">debug</a> = par(<span class="stringliteral">&quot;debug&quot;</span>).boolValue() : <a class="code" href="a00027.html#af32711ea117b066fcd10081a17bb81d4" title="Debug switch for all other modules.">debug</a> = <span class="keyword">true</span>;
        <a class="code" href="a00027.html#aabf0226159b22b46e70031fd3bb3b1b2" title="Function to get a pointer to the host module.">findHost</a>()-&gt;subscribe(<a class="code" href="a00027.html#a0d89757df3cc2bf55649eee85aad6402" title="Stores the category of the HostState.">catHostStateSignal</a>.<a class="code" href="a00201.html#aa01f017b96087bc252445206777e0080">initialize</a>(), <span class="keyword">this</span>);
    }
}
</pre></div>
</div>
</div>
<a class="anchor" id="a662d45fd2e3edf53d40e84b98f4dc885"></a><!-- doxytag: member="BaseModule::logName" ref="a662d45fd2e3edf53d40e84b98f4dc885" args="(void) const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">std::string BaseModule::logName </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Function to get the logging name of the host. </p>
<p>The logging name is the ned module name of the host (unless the host ned variable loggingName is specified). It can be used for logging messages to simplify debugging in TKEnv.</p>
<p>This function returns the logging name of the module with the specified id. It can be used for logging messages to simplify debugging in TKEnv.</p>
<p>Only supports ids from simple module derived from the <a class="el" href="a00027.html" title="Base class for all simple modules of a host.">BaseModule</a> or the nic compound module id.</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">id</td><td>Id of the module for the desired logging name </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>logging name of module id or NULL if not found </dd></dl>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="a00027.html#a662d45fd2e3edf53d40e84b98f4dc885" title="Function to get the logging name of the host.">logName</a> </dd></dl>

<p>References <a class="el" href="a00027.html#aabf0226159b22b46e70031fd3bb3b1b2">findHost()</a>.</p>
<div class="fragment"><pre class="fragment">{
  std::ostringstream ost;
  <span class="keywordflow">if</span> (hasPar(<span class="stringliteral">&quot;logName&quot;</span>)) <span class="comment">// let modules override</span>
  {
    ost &lt;&lt; par(<span class="stringliteral">&quot;logName&quot;</span>).stringValue();
  }
  <span class="keywordflow">else</span>
  {
    <span class="keyword">const</span> cModule *<span class="keyword">const</span> parent = <a class="code" href="a00027.html#aabf0226159b22b46e70031fd3bb3b1b2" title="Function to get a pointer to the host module.">findHost</a>();
    parent-&gt;hasPar(<span class="stringliteral">&quot;logName&quot;</span>) ?
      ost &lt;&lt; parent-&gt;par(<span class="stringliteral">&quot;logName&quot;</span>).stringValue() : ost &lt;&lt; parent-&gt;getName();
    ost &lt;&lt; <span class="stringliteral">&quot;[&quot;</span> &lt;&lt; parent-&gt;getIndex() &lt;&lt; <span class="stringliteral">&quot;]&quot;</span>;
  }
  <span class="keywordflow">return</span> ost.str();
}
</pre></div>
</div>
</div>
<a class="anchor" id="ace4692f0eb43b2d4ca4e46f81b5c77a1"></a><!-- doxytag: member="BaseModule::numInitStages" ref="ace4692f0eb43b2d4ca4e46f81b5c77a1" args="() const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">virtual int BaseModule::numInitStages </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const<code> [inline, virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Divide initialization into two stages. </p>
<p>In the first stage (stage==0), modules subscribe to notification. The first notifications (e.g. about the initial values of some variables such as RadioState) should take place earliest in the second stage (stage==1), when everyone interested in them has already subscribed. Further one should try to keep calls to other modules out of stage 0 to assure that the other module had at least once the chance to initialize itself in stage 0. </p>
<div class="fragment"><pre class="fragment">                                      {
      <span class="keywordflow">return</span> 2;
    }
</pre></div>
</div>
</div>
<a class="anchor" id="a2edf4477674604a8c2eb2b95e952694a"></a><!-- doxytag: member="BaseModule::switchHostState" ref="a2edf4477674604a8c2eb2b95e952694a" args="(HostState::States state)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void BaseModule::switchHostState </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="a00098.html#a5002302e0f07bbd982c6e5d65eaa9c3c">HostState::States</a>&#160;</td>
          <td class="paramname"><em>state</em></td><td>)</td>
          <td><code> [protected]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Switches the host to the passed state. </p>
<p>If the hosts state is switched to anything else than "ACTIVE" every module of the host has to handle this explicitly (see method "handleHostState()")! </p>

<p>References <a class="el" href="a00027.html#a0d89757df3cc2bf55649eee85aad6402">catHostStateSignal</a>.</p>
<div class="fragment"><pre class="fragment">{
  <a class="code" href="a00098.html" title="HostState is published by the battery to announce host failure.">HostState</a> hostState(state);
  emit(<a class="code" href="a00027.html#a0d89757df3cc2bf55649eee85aad6402" title="Stores the category of the HostState.">catHostStateSignal</a>, &amp;hostState);
}
</pre></div>
</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>D:/Projects/MiXiM/extsrc/mixim/src/base/modules/<a class="el" href="a00272_source.html">BaseModule.h</a></li>
<li>D:/Projects/MiXiM/extsrc/mixim/src/base/modules/BaseModule.cc</li>
</ul>
</div>
</div>
  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><a class="el" href="a00027.html">BaseModule</a>      </li>

    <li class="footer">Generated on Tue Mar 5 2013 21:26:31 for MiXiM by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.5.1 </li>
   </ul>
 </div>


</body>
</html>
